package org.tarry.springbootwebvalidation.validation.annotation;

import org.tarry.springbootwebvalidation.validation.validator.CustomerCodeValidator;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
// 标志注解使用范围
@Target(ElementType.FIELD)
//
@Retention(RetentionPolicy.RUNTIME)

// 指定校验逻辑
@Constraint(validatedBy = CustomerCodeValidator.class)
public @interface CustomerCode {
    boolean canNull() default true;
    String message() default "请输入合法的客户编号";
    // 默认必须的两个属性
    Class<?> [] groups() default {};
    Class<? extends Payload> [] payload() default {};
}
